#include <iostream>
using namespace std;
#define gua(i,a,b) for(int i=(a);i<=(b);++i)
#define qia(i,a,b) for(int i=(a);i>=(b);--i)
#define rua(i,a,b) for(int i=(a);i*i<=(b);++i)
int n,step;
bool lit[10005];
void tuon(int k){
	++step;
	rua(i,1,k)
		if(!(k%i)){
			lit[i]=!lit[i];
			if(i*i!=k)lit[k/i]=!lit[k/i];
		}
}
int main(){
	cin>>n;
	gua(i,1,n)cin>>lit[i];
	qia(i,n,1)if(lit[i])tuon(i);
	cout<<step<<endl;
	return 0;
}
